{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "908541a7-8c7f-4483-8388-66c8a2e45550",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "import torch\n",
    "\n",
    "from AuEnClass import AutoEncoder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "07326a04-e3ab-45c7-8e77-a174c6586f6b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>杭州市</th>\n",
       "      <th>金华市</th>\n",
       "      <th>台州市</th>\n",
       "      <th>绍兴市</th>\n",
       "      <th>温州市</th>\n",
       "      <th>宁波市</th>\n",
       "      <th>湖州市</th>\n",
       "      <th>嘉兴市</th>\n",
       "      <th>丽水市</th>\n",
       "      <th>衢州市</th>\n",
       "      <th>舟山市</th>\n",
       "      <th>时间</th>\n",
       "      <th>受伤人数</th>\n",
       "      <th>死亡人数</th>\n",
       "      <th>总理赔金额</th>\n",
       "      <th>总出险数量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>154</td>\n",
       "      <td>90</td>\n",
       "      <td>78</td>\n",
       "      <td>66</td>\n",
       "      <td>64</td>\n",
       "      <td>62.0</td>\n",
       "      <td>58</td>\n",
       "      <td>54</td>\n",
       "      <td>32</td>\n",
       "      <td>26.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>2018-09</td>\n",
       "      <td>126.0</td>\n",
       "      <td>4</td>\n",
       "      <td>16323553.30</td>\n",
       "      <td>708</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>756</td>\n",
       "      <td>343</td>\n",
       "      <td>238</td>\n",
       "      <td>203</td>\n",
       "      <td>259</td>\n",
       "      <td>196.0</td>\n",
       "      <td>189</td>\n",
       "      <td>140</td>\n",
       "      <td>63</td>\n",
       "      <td>133.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>2018-10</td>\n",
       "      <td>427.0</td>\n",
       "      <td>7</td>\n",
       "      <td>66517188.36</td>\n",
       "      <td>2569</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>840</td>\n",
       "      <td>315</td>\n",
       "      <td>280</td>\n",
       "      <td>189</td>\n",
       "      <td>210</td>\n",
       "      <td>154.0</td>\n",
       "      <td>126</td>\n",
       "      <td>140</td>\n",
       "      <td>133</td>\n",
       "      <td>126.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>2018-11</td>\n",
       "      <td>385.0</td>\n",
       "      <td>7</td>\n",
       "      <td>56063686.77</td>\n",
       "      <td>2548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1112</td>\n",
       "      <td>803</td>\n",
       "      <td>584</td>\n",
       "      <td>257</td>\n",
       "      <td>1485</td>\n",
       "      <td>1088.0</td>\n",
       "      <td>377</td>\n",
       "      <td>526</td>\n",
       "      <td>147</td>\n",
       "      <td>190.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>2019-01</td>\n",
       "      <td>675.0</td>\n",
       "      <td>52</td>\n",
       "      <td>33307029.74</td>\n",
       "      <td>6724</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52</td>\n",
       "      <td>12</td>\n",
       "      <td>14</td>\n",
       "      <td>43</td>\n",
       "      <td>39</td>\n",
       "      <td>96.0</td>\n",
       "      <td>25</td>\n",
       "      <td>30</td>\n",
       "      <td>6</td>\n",
       "      <td>14.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2019-02</td>\n",
       "      <td>30.0</td>\n",
       "      <td>6</td>\n",
       "      <td>357098.00</td>\n",
       "      <td>337</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>73</td>\n",
       "      <td>22</td>\n",
       "      <td>34</td>\n",
       "      <td>18</td>\n",
       "      <td>77</td>\n",
       "      <td>20.0</td>\n",
       "      <td>13</td>\n",
       "      <td>15</td>\n",
       "      <td>5</td>\n",
       "      <td>13.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2019-03</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1</td>\n",
       "      <td>528790.70</td>\n",
       "      <td>296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>62</td>\n",
       "      <td>26</td>\n",
       "      <td>19</td>\n",
       "      <td>16</td>\n",
       "      <td>60</td>\n",
       "      <td>18.0</td>\n",
       "      <td>27</td>\n",
       "      <td>20</td>\n",
       "      <td>8</td>\n",
       "      <td>13.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2019-04</td>\n",
       "      <td>12.0</td>\n",
       "      <td>3</td>\n",
       "      <td>617496.78</td>\n",
       "      <td>272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>197</td>\n",
       "      <td>67</td>\n",
       "      <td>73</td>\n",
       "      <td>52</td>\n",
       "      <td>206</td>\n",
       "      <td>97.0</td>\n",
       "      <td>52</td>\n",
       "      <td>65</td>\n",
       "      <td>17</td>\n",
       "      <td>18.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>2019-05</td>\n",
       "      <td>79.0</td>\n",
       "      <td>6</td>\n",
       "      <td>2101444.89</td>\n",
       "      <td>1012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>233</td>\n",
       "      <td>107</td>\n",
       "      <td>73</td>\n",
       "      <td>74</td>\n",
       "      <td>231</td>\n",
       "      <td>114.0</td>\n",
       "      <td>50</td>\n",
       "      <td>96</td>\n",
       "      <td>12</td>\n",
       "      <td>23.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>2019-06</td>\n",
       "      <td>140.0</td>\n",
       "      <td>9</td>\n",
       "      <td>3391977.21</td>\n",
       "      <td>1309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>273</td>\n",
       "      <td>110</td>\n",
       "      <td>72</td>\n",
       "      <td>67</td>\n",
       "      <td>235</td>\n",
       "      <td>148.0</td>\n",
       "      <td>66</td>\n",
       "      <td>98</td>\n",
       "      <td>26</td>\n",
       "      <td>41.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>2019-07</td>\n",
       "      <td>119.0</td>\n",
       "      <td>5</td>\n",
       "      <td>3432709.15</td>\n",
       "      <td>1470</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>244</td>\n",
       "      <td>94</td>\n",
       "      <td>75</td>\n",
       "      <td>72</td>\n",
       "      <td>281</td>\n",
       "      <td>170.0</td>\n",
       "      <td>71</td>\n",
       "      <td>92</td>\n",
       "      <td>26</td>\n",
       "      <td>23.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>2019-08</td>\n",
       "      <td>147.0</td>\n",
       "      <td>5</td>\n",
       "      <td>2612103.78</td>\n",
       "      <td>1530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>182</td>\n",
       "      <td>133</td>\n",
       "      <td>85</td>\n",
       "      <td>68</td>\n",
       "      <td>243</td>\n",
       "      <td>141.0</td>\n",
       "      <td>53</td>\n",
       "      <td>100</td>\n",
       "      <td>28</td>\n",
       "      <td>31.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>2019-09</td>\n",
       "      <td>140.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3468982.14</td>\n",
       "      <td>1379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>284</td>\n",
       "      <td>132</td>\n",
       "      <td>88</td>\n",
       "      <td>102</td>\n",
       "      <td>296</td>\n",
       "      <td>152.0</td>\n",
       "      <td>66</td>\n",
       "      <td>101</td>\n",
       "      <td>43</td>\n",
       "      <td>37.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>2019-10</td>\n",
       "      <td>121.0</td>\n",
       "      <td>5</td>\n",
       "      <td>2817171.30</td>\n",
       "      <td>1696</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>298</td>\n",
       "      <td>137</td>\n",
       "      <td>122</td>\n",
       "      <td>102</td>\n",
       "      <td>316</td>\n",
       "      <td>177.0</td>\n",
       "      <td>81</td>\n",
       "      <td>108</td>\n",
       "      <td>35</td>\n",
       "      <td>41.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>2019-11</td>\n",
       "      <td>115.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3034704.33</td>\n",
       "      <td>1601</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>404</td>\n",
       "      <td>156</td>\n",
       "      <td>138</td>\n",
       "      <td>110</td>\n",
       "      <td>405</td>\n",
       "      <td>189.0</td>\n",
       "      <td>85</td>\n",
       "      <td>115</td>\n",
       "      <td>34</td>\n",
       "      <td>36.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>2019-12</td>\n",
       "      <td>159.0</td>\n",
       "      <td>5</td>\n",
       "      <td>3911934.62</td>\n",
       "      <td>1713</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>267</td>\n",
       "      <td>108</td>\n",
       "      <td>58</td>\n",
       "      <td>57</td>\n",
       "      <td>182</td>\n",
       "      <td>63.0</td>\n",
       "      <td>49</td>\n",
       "      <td>55</td>\n",
       "      <td>8</td>\n",
       "      <td>29.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2020-01</td>\n",
       "      <td>62.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2321625.99</td>\n",
       "      <td>936</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2020-02</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>18940.00</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>196</td>\n",
       "      <td>117</td>\n",
       "      <td>79</td>\n",
       "      <td>57</td>\n",
       "      <td>225</td>\n",
       "      <td>65.0</td>\n",
       "      <td>68</td>\n",
       "      <td>66</td>\n",
       "      <td>18</td>\n",
       "      <td>13.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>2020-03</td>\n",
       "      <td>72.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1738460.46</td>\n",
       "      <td>945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>477</td>\n",
       "      <td>169</td>\n",
       "      <td>144</td>\n",
       "      <td>124</td>\n",
       "      <td>439</td>\n",
       "      <td>91.0</td>\n",
       "      <td>130</td>\n",
       "      <td>182</td>\n",
       "      <td>53</td>\n",
       "      <td>55.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>2020-04</td>\n",
       "      <td>192.0</td>\n",
       "      <td>9</td>\n",
       "      <td>6108887.21</td>\n",
       "      <td>2284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>311</td>\n",
       "      <td>172</td>\n",
       "      <td>75</td>\n",
       "      <td>70</td>\n",
       "      <td>214</td>\n",
       "      <td>89.0</td>\n",
       "      <td>72</td>\n",
       "      <td>121</td>\n",
       "      <td>36</td>\n",
       "      <td>30.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>2020-05</td>\n",
       "      <td>143.0</td>\n",
       "      <td>5</td>\n",
       "      <td>4596057.80</td>\n",
       "      <td>1818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>228</td>\n",
       "      <td>106</td>\n",
       "      <td>81</td>\n",
       "      <td>94</td>\n",
       "      <td>256</td>\n",
       "      <td>63.0</td>\n",
       "      <td>55</td>\n",
       "      <td>74</td>\n",
       "      <td>19</td>\n",
       "      <td>14.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>2020-06</td>\n",
       "      <td>121.0</td>\n",
       "      <td>6</td>\n",
       "      <td>3005392.41</td>\n",
       "      <td>1324</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>342</td>\n",
       "      <td>129</td>\n",
       "      <td>77</td>\n",
       "      <td>105</td>\n",
       "      <td>350</td>\n",
       "      <td>49.0</td>\n",
       "      <td>77</td>\n",
       "      <td>134</td>\n",
       "      <td>20</td>\n",
       "      <td>22.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2020-07</td>\n",
       "      <td>90.0</td>\n",
       "      <td>6</td>\n",
       "      <td>3126541.33</td>\n",
       "      <td>1476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>351</td>\n",
       "      <td>173</td>\n",
       "      <td>113</td>\n",
       "      <td>139</td>\n",
       "      <td>383</td>\n",
       "      <td>66.0</td>\n",
       "      <td>119</td>\n",
       "      <td>158</td>\n",
       "      <td>27</td>\n",
       "      <td>36.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>2020-08</td>\n",
       "      <td>110.0</td>\n",
       "      <td>6</td>\n",
       "      <td>4603308.12</td>\n",
       "      <td>1739</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>258</td>\n",
       "      <td>162</td>\n",
       "      <td>92</td>\n",
       "      <td>98</td>\n",
       "      <td>323</td>\n",
       "      <td>65.0</td>\n",
       "      <td>90</td>\n",
       "      <td>108</td>\n",
       "      <td>28</td>\n",
       "      <td>24.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2020-09</td>\n",
       "      <td>84.0</td>\n",
       "      <td>6</td>\n",
       "      <td>3528179.53</td>\n",
       "      <td>1536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>175</td>\n",
       "      <td>126</td>\n",
       "      <td>105</td>\n",
       "      <td>94</td>\n",
       "      <td>260</td>\n",
       "      <td>62.0</td>\n",
       "      <td>56</td>\n",
       "      <td>106</td>\n",
       "      <td>21</td>\n",
       "      <td>25.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>2020-10</td>\n",
       "      <td>77.0</td>\n",
       "      <td>2</td>\n",
       "      <td>2831461.67</td>\n",
       "      <td>1613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>600</td>\n",
       "      <td>280</td>\n",
       "      <td>193</td>\n",
       "      <td>247</td>\n",
       "      <td>605</td>\n",
       "      <td>2.0</td>\n",
       "      <td>144</td>\n",
       "      <td>202</td>\n",
       "      <td>62</td>\n",
       "      <td>70.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>2020-11</td>\n",
       "      <td>125.0</td>\n",
       "      <td>5</td>\n",
       "      <td>7405707.64</td>\n",
       "      <td>3049</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>227</td>\n",
       "      <td>139</td>\n",
       "      <td>87</td>\n",
       "      <td>117</td>\n",
       "      <td>259</td>\n",
       "      <td>10.0</td>\n",
       "      <td>68</td>\n",
       "      <td>94</td>\n",
       "      <td>38</td>\n",
       "      <td>16.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2020-12</td>\n",
       "      <td>79.0</td>\n",
       "      <td>2</td>\n",
       "      <td>6542404.32</td>\n",
       "      <td>1715</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>219</td>\n",
       "      <td>142</td>\n",
       "      <td>106</td>\n",
       "      <td>120</td>\n",
       "      <td>268</td>\n",
       "      <td>89.0</td>\n",
       "      <td>72</td>\n",
       "      <td>100</td>\n",
       "      <td>37</td>\n",
       "      <td>48.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>2021-01</td>\n",
       "      <td>75.0</td>\n",
       "      <td>7</td>\n",
       "      <td>6232348.63</td>\n",
       "      <td>1449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>18</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>4</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>2</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2021-02</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>76910.00</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>257</td>\n",
       "      <td>137</td>\n",
       "      <td>69</td>\n",
       "      <td>84</td>\n",
       "      <td>292</td>\n",
       "      <td>106.0</td>\n",
       "      <td>79</td>\n",
       "      <td>97</td>\n",
       "      <td>20</td>\n",
       "      <td>33.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2021-03</td>\n",
       "      <td>57.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2281498.14</td>\n",
       "      <td>1186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>359</td>\n",
       "      <td>144</td>\n",
       "      <td>125</td>\n",
       "      <td>129</td>\n",
       "      <td>389</td>\n",
       "      <td>79.0</td>\n",
       "      <td>84</td>\n",
       "      <td>144</td>\n",
       "      <td>28</td>\n",
       "      <td>38.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>2021-04</td>\n",
       "      <td>66.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3034097.18</td>\n",
       "      <td>1533</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>345</td>\n",
       "      <td>145</td>\n",
       "      <td>71</td>\n",
       "      <td>116</td>\n",
       "      <td>329</td>\n",
       "      <td>95.0</td>\n",
       "      <td>96</td>\n",
       "      <td>150</td>\n",
       "      <td>34</td>\n",
       "      <td>32.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>2021-05</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3342214.81</td>\n",
       "      <td>1426</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>330</td>\n",
       "      <td>139</td>\n",
       "      <td>70</td>\n",
       "      <td>107</td>\n",
       "      <td>319</td>\n",
       "      <td>78.0</td>\n",
       "      <td>60</td>\n",
       "      <td>119</td>\n",
       "      <td>20</td>\n",
       "      <td>38.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>2021-06</td>\n",
       "      <td>54.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3204576.08</td>\n",
       "      <td>1295</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>260</td>\n",
       "      <td>134</td>\n",
       "      <td>90</td>\n",
       "      <td>108</td>\n",
       "      <td>283</td>\n",
       "      <td>80.0</td>\n",
       "      <td>70</td>\n",
       "      <td>88</td>\n",
       "      <td>36</td>\n",
       "      <td>42.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2021-07</td>\n",
       "      <td>73.0</td>\n",
       "      <td>3</td>\n",
       "      <td>3061251.80</td>\n",
       "      <td>1201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>338</td>\n",
       "      <td>135</td>\n",
       "      <td>100</td>\n",
       "      <td>106</td>\n",
       "      <td>312</td>\n",
       "      <td>73.0</td>\n",
       "      <td>70</td>\n",
       "      <td>118</td>\n",
       "      <td>23</td>\n",
       "      <td>54.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2021-08</td>\n",
       "      <td>58.0</td>\n",
       "      <td>3</td>\n",
       "      <td>3240960.03</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>356</td>\n",
       "      <td>153</td>\n",
       "      <td>90</td>\n",
       "      <td>119</td>\n",
       "      <td>312</td>\n",
       "      <td>78.0</td>\n",
       "      <td>87</td>\n",
       "      <td>109</td>\n",
       "      <td>32</td>\n",
       "      <td>37.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>2021-09</td>\n",
       "      <td>66.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2994837.27</td>\n",
       "      <td>1393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>298</td>\n",
       "      <td>148</td>\n",
       "      <td>78</td>\n",
       "      <td>100</td>\n",
       "      <td>285</td>\n",
       "      <td>52.0</td>\n",
       "      <td>64</td>\n",
       "      <td>117</td>\n",
       "      <td>32</td>\n",
       "      <td>44.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>2021-10</td>\n",
       "      <td>53.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2897297.45</td>\n",
       "      <td>1236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>294</td>\n",
       "      <td>169</td>\n",
       "      <td>85</td>\n",
       "      <td>111</td>\n",
       "      <td>312</td>\n",
       "      <td>46.0</td>\n",
       "      <td>66</td>\n",
       "      <td>114</td>\n",
       "      <td>25</td>\n",
       "      <td>42.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2021-11</td>\n",
       "      <td>61.0</td>\n",
       "      <td>6</td>\n",
       "      <td>4185235.52</td>\n",
       "      <td>1282</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     杭州市  金华市  台州市  绍兴市   温州市     宁波市  湖州市  嘉兴市  丽水市    衢州市    舟山市       时间  \\\n",
       "0    154   90   78   66    64    62.0   58   54   32   26.0   24.0  2018-09   \n",
       "1    756  343  238  203   259   196.0  189  140   63  133.0   49.0  2018-10   \n",
       "2    840  315  280  189   210   154.0  126  140  133  126.0   35.0  2018-11   \n",
       "3   1112  803  584  257  1485  1088.0  377  526  147  190.0  155.0  2019-01   \n",
       "4     52   12   14   43    39    96.0   25   30    6   14.0    6.0  2019-02   \n",
       "5     73   22   34   18    77    20.0   13   15    5   13.0    6.0  2019-03   \n",
       "6     62   26   19   16    60    18.0   27   20    8   13.0    3.0  2019-04   \n",
       "7    197   67   73   52   206    97.0   52   65   17   18.0   22.0  2019-05   \n",
       "8    233  107   73   74   231   114.0   50   96   12   23.0   16.0  2019-06   \n",
       "9    273  110   72   67   235   148.0   66   98   26   41.0   15.0  2019-07   \n",
       "10   244   94   75   72   281   170.0   71   92   26   23.0   22.0  2019-08   \n",
       "11   182  133   85   68   243   141.0   53  100   28   31.0   14.0  2019-09   \n",
       "12   284  132   88  102   296   152.0   66  101   43   37.0   15.0  2019-10   \n",
       "13   298  137  122  102   316   177.0   81  108   35   41.0   20.0  2019-11   \n",
       "14   404  156  138  110   405   189.0   85  115   34   36.0   30.0  2019-12   \n",
       "15   267  108   58   57   182    63.0   49   55    8   29.0   12.0  2020-01   \n",
       "16     9    3    2    3     2     0.0    2    4    1    0.0    2.0  2020-02   \n",
       "17   196  117   79   57   225    65.0   68   66   18   13.0   18.0  2020-03   \n",
       "18   477  169  144  124   439    91.0  130  182   53   55.0   34.0  2020-04   \n",
       "19   311  172   75   70   214    89.0   72  121   36   30.0   15.0  2020-05   \n",
       "20   228  106   81   94   256    63.0   55   74   19   14.0   10.0  2020-06   \n",
       "21   342  129   77  105   350    49.0   77  134   20   22.0    8.0  2020-07   \n",
       "22   351  173  113  139   383    66.0  119  158   27   36.0   13.0  2020-08   \n",
       "23   258  162   92   98   323    65.0   90  108   28   24.0   12.0  2020-09   \n",
       "24   175  126  105   94   260    62.0   56  106   21   25.0   15.0  2020-10   \n",
       "25   600  280  193  247   605     2.0  144  202   62   70.0   17.0  2020-11   \n",
       "26   227  139   87  117   259    10.0   68   94   38   16.0    3.0  2020-12   \n",
       "27   219  142  106  120   268    89.0   72  100   37   48.0   10.0  2021-01   \n",
       "28    18    6    5    9     4     7.0    1    6    2    4.0    0.0  2021-02   \n",
       "29   257  137   69   84   292   106.0   79   97   20   33.0   12.0  2021-03   \n",
       "30   359  144  125  129   389    79.0   84  144   28   38.0   14.0  2021-04   \n",
       "31   345  145   71  116   329    95.0   96  150   34   32.0   13.0  2021-05   \n",
       "32   330  139   70  107   319    78.0   60  119   20   38.0   14.0  2021-06   \n",
       "33   260  134   90  108   283    80.0   70   88   36   42.0    7.0  2021-07   \n",
       "34   338  135  100  106   312    73.0   70  118   23   54.0   12.0  2021-08   \n",
       "35   356  153   90  119   312    78.0   87  109   32   37.0   11.0  2021-09   \n",
       "36   298  148   78  100   285    52.0   64  117   32   44.0   14.0  2021-10   \n",
       "37   294  169   85  111   312    46.0   66  114   25   42.0    6.0  2021-11   \n",
       "\n",
       "     受伤人数  死亡人数        总理赔金额  总出险数量  \n",
       "0   126.0     4  16323553.30    708  \n",
       "1   427.0     7  66517188.36   2569  \n",
       "2   385.0     7  56063686.77   2548  \n",
       "3   675.0    52  33307029.74   6724  \n",
       "4    30.0     6    357098.00    337  \n",
       "5     9.0     1    528790.70    296  \n",
       "6    12.0     3    617496.78    272  \n",
       "7    79.0     6   2101444.89   1012  \n",
       "8   140.0     9   3391977.21   1309  \n",
       "9   119.0     5   3432709.15   1470  \n",
       "10  147.0     5   2612103.78   1530  \n",
       "11  140.0     7   3468982.14   1379  \n",
       "12  121.0     5   2817171.30   1696  \n",
       "13  115.0     7   3034704.33   1601  \n",
       "14  159.0     5   3911934.62   1713  \n",
       "15   62.0     4   2321625.99    936  \n",
       "16    2.0     0     18940.00     30  \n",
       "17   72.0     2   1738460.46    945  \n",
       "18  192.0     9   6108887.21   2284  \n",
       "19  143.0     5   4596057.80   1818  \n",
       "20  121.0     6   3005392.41   1324  \n",
       "21   90.0     6   3126541.33   1476  \n",
       "22  110.0     6   4603308.12   1739  \n",
       "23   84.0     6   3528179.53   1536  \n",
       "24   77.0     2   2831461.67   1613  \n",
       "25  125.0     5   7405707.64   3049  \n",
       "26   79.0     2   6542404.32   1715  \n",
       "27   75.0     7   6232348.63   1449  \n",
       "28    2.0     0     76910.00     62  \n",
       "29   57.0     1   2281498.14   1186  \n",
       "30   66.0     7   3034097.18   1533  \n",
       "31   57.0     0   3342214.81   1426  \n",
       "32   54.0     1   3204576.08   1295  \n",
       "33   73.0     3   3061251.80   1201  \n",
       "34   58.0     3   3240960.03   1349  \n",
       "35   66.0     4   2994837.27   1393  \n",
       "36   53.0     4   2897297.45   1236  \n",
       "37   61.0     6   4185235.52   1282  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# data = np.random.random((100,14))\n",
    "data=pd.read_csv(\"data/train.csv\")\n",
    "d1=data\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "28f7ccc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.540e+02, 9.000e+01, 7.800e+01, 6.600e+01, 6.400e+01, 6.200e+01,\n",
       "        5.800e+01, 5.400e+01, 3.200e+01, 2.600e+01, 2.400e+01, 1.260e+02,\n",
       "        4.000e+00],\n",
       "       [7.560e+02, 3.430e+02, 2.380e+02, 2.030e+02, 2.590e+02, 1.960e+02,\n",
       "        1.890e+02, 1.400e+02, 6.300e+01, 1.330e+02, 4.900e+01, 4.270e+02,\n",
       "        7.000e+00],\n",
       "       [8.400e+02, 3.150e+02, 2.800e+02, 1.890e+02, 2.100e+02, 1.540e+02,\n",
       "        1.260e+02, 1.400e+02, 1.330e+02, 1.260e+02, 3.500e+01, 3.850e+02,\n",
       "        7.000e+00],\n",
       "       [1.112e+03, 8.030e+02, 5.840e+02, 2.570e+02, 1.485e+03, 1.088e+03,\n",
       "        3.770e+02, 5.260e+02, 1.470e+02, 1.900e+02, 1.550e+02, 6.750e+02,\n",
       "        5.200e+01],\n",
       "       [5.200e+01, 1.200e+01, 1.400e+01, 4.300e+01, 3.900e+01, 9.600e+01,\n",
       "        2.500e+01, 3.000e+01, 6.000e+00, 1.400e+01, 6.000e+00, 3.000e+01,\n",
       "        6.000e+00],\n",
       "       [7.300e+01, 2.200e+01, 3.400e+01, 1.800e+01, 7.700e+01, 2.000e+01,\n",
       "        1.300e+01, 1.500e+01, 5.000e+00, 1.300e+01, 6.000e+00, 9.000e+00,\n",
       "        1.000e+00],\n",
       "       [6.200e+01, 2.600e+01, 1.900e+01, 1.600e+01, 6.000e+01, 1.800e+01,\n",
       "        2.700e+01, 2.000e+01, 8.000e+00, 1.300e+01, 3.000e+00, 1.200e+01,\n",
       "        3.000e+00],\n",
       "       [1.970e+02, 6.700e+01, 7.300e+01, 5.200e+01, 2.060e+02, 9.700e+01,\n",
       "        5.200e+01, 6.500e+01, 1.700e+01, 1.800e+01, 2.200e+01, 7.900e+01,\n",
       "        6.000e+00],\n",
       "       [2.330e+02, 1.070e+02, 7.300e+01, 7.400e+01, 2.310e+02, 1.140e+02,\n",
       "        5.000e+01, 9.600e+01, 1.200e+01, 2.300e+01, 1.600e+01, 1.400e+02,\n",
       "        9.000e+00],\n",
       "       [2.730e+02, 1.100e+02, 7.200e+01, 6.700e+01, 2.350e+02, 1.480e+02,\n",
       "        6.600e+01, 9.800e+01, 2.600e+01, 4.100e+01, 1.500e+01, 1.190e+02,\n",
       "        5.000e+00],\n",
       "       [2.440e+02, 9.400e+01, 7.500e+01, 7.200e+01, 2.810e+02, 1.700e+02,\n",
       "        7.100e+01, 9.200e+01, 2.600e+01, 2.300e+01, 2.200e+01, 1.470e+02,\n",
       "        5.000e+00],\n",
       "       [1.820e+02, 1.330e+02, 8.500e+01, 6.800e+01, 2.430e+02, 1.410e+02,\n",
       "        5.300e+01, 1.000e+02, 2.800e+01, 3.100e+01, 1.400e+01, 1.400e+02,\n",
       "        7.000e+00],\n",
       "       [2.840e+02, 1.320e+02, 8.800e+01, 1.020e+02, 2.960e+02, 1.520e+02,\n",
       "        6.600e+01, 1.010e+02, 4.300e+01, 3.700e+01, 1.500e+01, 1.210e+02,\n",
       "        5.000e+00],\n",
       "       [2.980e+02, 1.370e+02, 1.220e+02, 1.020e+02, 3.160e+02, 1.770e+02,\n",
       "        8.100e+01, 1.080e+02, 3.500e+01, 4.100e+01, 2.000e+01, 1.150e+02,\n",
       "        7.000e+00],\n",
       "       [4.040e+02, 1.560e+02, 1.380e+02, 1.100e+02, 4.050e+02, 1.890e+02,\n",
       "        8.500e+01, 1.150e+02, 3.400e+01, 3.600e+01, 3.000e+01, 1.590e+02,\n",
       "        5.000e+00],\n",
       "       [2.670e+02, 1.080e+02, 5.800e+01, 5.700e+01, 1.820e+02, 6.300e+01,\n",
       "        4.900e+01, 5.500e+01, 8.000e+00, 2.900e+01, 1.200e+01, 6.200e+01,\n",
       "        4.000e+00],\n",
       "       [9.000e+00, 3.000e+00, 2.000e+00, 3.000e+00, 2.000e+00, 0.000e+00,\n",
       "        2.000e+00, 4.000e+00, 1.000e+00, 0.000e+00, 2.000e+00, 2.000e+00,\n",
       "        0.000e+00],\n",
       "       [1.960e+02, 1.170e+02, 7.900e+01, 5.700e+01, 2.250e+02, 6.500e+01,\n",
       "        6.800e+01, 6.600e+01, 1.800e+01, 1.300e+01, 1.800e+01, 7.200e+01,\n",
       "        2.000e+00],\n",
       "       [4.770e+02, 1.690e+02, 1.440e+02, 1.240e+02, 4.390e+02, 9.100e+01,\n",
       "        1.300e+02, 1.820e+02, 5.300e+01, 5.500e+01, 3.400e+01, 1.920e+02,\n",
       "        9.000e+00],\n",
       "       [3.110e+02, 1.720e+02, 7.500e+01, 7.000e+01, 2.140e+02, 8.900e+01,\n",
       "        7.200e+01, 1.210e+02, 3.600e+01, 3.000e+01, 1.500e+01, 1.430e+02,\n",
       "        5.000e+00],\n",
       "       [2.280e+02, 1.060e+02, 8.100e+01, 9.400e+01, 2.560e+02, 6.300e+01,\n",
       "        5.500e+01, 7.400e+01, 1.900e+01, 1.400e+01, 1.000e+01, 1.210e+02,\n",
       "        6.000e+00],\n",
       "       [3.420e+02, 1.290e+02, 7.700e+01, 1.050e+02, 3.500e+02, 4.900e+01,\n",
       "        7.700e+01, 1.340e+02, 2.000e+01, 2.200e+01, 8.000e+00, 9.000e+01,\n",
       "        6.000e+00],\n",
       "       [3.510e+02, 1.730e+02, 1.130e+02, 1.390e+02, 3.830e+02, 6.600e+01,\n",
       "        1.190e+02, 1.580e+02, 2.700e+01, 3.600e+01, 1.300e+01, 1.100e+02,\n",
       "        6.000e+00],\n",
       "       [2.580e+02, 1.620e+02, 9.200e+01, 9.800e+01, 3.230e+02, 6.500e+01,\n",
       "        9.000e+01, 1.080e+02, 2.800e+01, 2.400e+01, 1.200e+01, 8.400e+01,\n",
       "        6.000e+00],\n",
       "       [1.750e+02, 1.260e+02, 1.050e+02, 9.400e+01, 2.600e+02, 6.200e+01,\n",
       "        5.600e+01, 1.060e+02, 2.100e+01, 2.500e+01, 1.500e+01, 7.700e+01,\n",
       "        2.000e+00],\n",
       "       [6.000e+02, 2.800e+02, 1.930e+02, 2.470e+02, 6.050e+02, 2.000e+00,\n",
       "        1.440e+02, 2.020e+02, 6.200e+01, 7.000e+01, 1.700e+01, 1.250e+02,\n",
       "        5.000e+00],\n",
       "       [2.270e+02, 1.390e+02, 8.700e+01, 1.170e+02, 2.590e+02, 1.000e+01,\n",
       "        6.800e+01, 9.400e+01, 3.800e+01, 1.600e+01, 3.000e+00, 7.900e+01,\n",
       "        2.000e+00],\n",
       "       [2.190e+02, 1.420e+02, 1.060e+02, 1.200e+02, 2.680e+02, 8.900e+01,\n",
       "        7.200e+01, 1.000e+02, 3.700e+01, 4.800e+01, 1.000e+01, 7.500e+01,\n",
       "        7.000e+00],\n",
       "       [1.800e+01, 6.000e+00, 5.000e+00, 9.000e+00, 4.000e+00, 7.000e+00,\n",
       "        1.000e+00, 6.000e+00, 2.000e+00, 4.000e+00, 0.000e+00, 2.000e+00,\n",
       "        0.000e+00],\n",
       "       [2.570e+02, 1.370e+02, 6.900e+01, 8.400e+01, 2.920e+02, 1.060e+02,\n",
       "        7.900e+01, 9.700e+01, 2.000e+01, 3.300e+01, 1.200e+01, 5.700e+01,\n",
       "        1.000e+00],\n",
       "       [3.590e+02, 1.440e+02, 1.250e+02, 1.290e+02, 3.890e+02, 7.900e+01,\n",
       "        8.400e+01, 1.440e+02, 2.800e+01, 3.800e+01, 1.400e+01, 6.600e+01,\n",
       "        7.000e+00],\n",
       "       [3.450e+02, 1.450e+02, 7.100e+01, 1.160e+02, 3.290e+02, 9.500e+01,\n",
       "        9.600e+01, 1.500e+02, 3.400e+01, 3.200e+01, 1.300e+01, 5.700e+01,\n",
       "        0.000e+00],\n",
       "       [3.300e+02, 1.390e+02, 7.000e+01, 1.070e+02, 3.190e+02, 7.800e+01,\n",
       "        6.000e+01, 1.190e+02, 2.000e+01, 3.800e+01, 1.400e+01, 5.400e+01,\n",
       "        1.000e+00],\n",
       "       [2.600e+02, 1.340e+02, 9.000e+01, 1.080e+02, 2.830e+02, 8.000e+01,\n",
       "        7.000e+01, 8.800e+01, 3.600e+01, 4.200e+01, 7.000e+00, 7.300e+01,\n",
       "        3.000e+00],\n",
       "       [3.380e+02, 1.350e+02, 1.000e+02, 1.060e+02, 3.120e+02, 7.300e+01,\n",
       "        7.000e+01, 1.180e+02, 2.300e+01, 5.400e+01, 1.200e+01, 5.800e+01,\n",
       "        3.000e+00],\n",
       "       [3.560e+02, 1.530e+02, 9.000e+01, 1.190e+02, 3.120e+02, 7.800e+01,\n",
       "        8.700e+01, 1.090e+02, 3.200e+01, 3.700e+01, 1.100e+01, 6.600e+01,\n",
       "        4.000e+00],\n",
       "       [2.980e+02, 1.480e+02, 7.800e+01, 1.000e+02, 2.850e+02, 5.200e+01,\n",
       "        6.400e+01, 1.170e+02, 3.200e+01, 4.400e+01, 1.400e+01, 5.300e+01,\n",
       "        4.000e+00],\n",
       "       [2.940e+02, 1.690e+02, 8.500e+01, 1.110e+02, 3.120e+02, 4.600e+01,\n",
       "        6.600e+01, 1.140e+02, 2.500e+01, 4.200e+01, 6.000e+00, 6.100e+01,\n",
       "        6.000e+00]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "features=[\"杭州市\",\"金华市\",\"台州市\",\"绍兴市\",\"温州市\",\"宁波市\",\"湖州市\",\"嘉兴市\",\"丽水市\",\"衢州市\",\"舟山市\",\"受伤人数\",\"死亡人数\"]\n",
    "data=data[features]\n",
    "data=data.values\n",
    "data\n",
    "# data=np.random.random((100,14))\n",
    "# data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b1cc88b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.71605778, -0.46342027, -0.27666752, -0.59284121, -0.98008052,\n",
       "        -0.29272731, -0.35239152, -0.68130254, -0.01718034, -0.3813322 ,\n",
       "         0.22425306,  0.06873226, -0.21776131],\n",
       "       [ 2.0950865 ,  1.50534795,  1.39876924,  1.88613979, -0.13344999,\n",
       "         0.50266621,  1.80265145,  0.37191255,  1.04800054,  2.5832887 ,\n",
       "         1.24848577,  2.48768482,  0.15837186],\n",
       "       [ 2.48733919,  1.28746056,  1.83857138,  1.63281327, -0.34619305,\n",
       "         0.25336377,  0.76625674,  0.37191255,  3.45324769,  2.38934154,\n",
       "         0.67491545,  2.15015656,  0.15837186],\n",
       "       [ 3.75749076,  5.08492653,  5.02190121,  2.8632564 ,  5.18946809,\n",
       "         5.79737534,  4.89538488,  5.09913379,  3.93429712,  4.16257274,\n",
       "         5.59123249,  4.48070886,  5.80036937],\n",
       "       [-1.19236461, -1.07039229, -0.94684222, -1.00902051, -1.0886229 ,\n",
       "        -0.09091104, -0.89526494, -0.97522303, -0.91055785, -0.71381305,\n",
       "        -0.5131945 , -0.70276092,  0.03299414],\n",
       "       [-1.09430144, -0.99257537, -0.73741262, -1.4613893 , -0.92363849,\n",
       "        -0.54202976, -1.09267346, -1.15892334, -0.94491852, -0.74151979,\n",
       "        -0.5131945 , -0.87152505, -0.59389447],\n",
       "       [-1.14566787, -0.9614486 , -0.89448482, -1.49757881, -0.9974473 ,\n",
       "        -0.5539013 , -0.86236352, -1.0976899 , -0.8418365 , -0.74151979,\n",
       "        -0.63610242, -0.84741589, -0.34313903],\n",
       "       [-0.51526176, -0.6423992 , -0.32902491, -0.84616774, -0.36355983,\n",
       "        -0.08497527, -0.45109578, -0.54658898, -0.53259044, -0.6029861 ,\n",
       "         0.14231444, -0.30897794,  0.03299414],\n",
       "       [-0.34715346, -0.3311315 , -0.32902491, -0.4480832 , -0.25501745,\n",
       "         0.01593286, -0.4839972 , -0.16694168, -0.70439381, -0.46445241,\n",
       "        -0.10350141,  0.18124168,  0.4091273 ],\n",
       "       [-0.16036647, -0.30778642, -0.33949639, -0.57474646, -0.23765067,\n",
       "         0.21774913, -0.22078584, -0.14244831, -0.22334438,  0.03426886,\n",
       "        -0.14447072,  0.01247755, -0.09238358],\n",
       "       [-0.29578704, -0.4322935 , -0.30808196, -0.4842727 , -0.0379327 ,\n",
       "         0.34833613, -0.13853229, -0.21592843, -0.22334438, -0.46445241,\n",
       "         0.14231444,  0.23749639, -0.09238358],\n",
       "       [-0.58530688, -0.12880749, -0.20336716, -0.55665171, -0.20291711,\n",
       "         0.17619872, -0.43464507, -0.11795493, -0.15462303, -0.24279851,\n",
       "        -0.18544003,  0.18124168,  0.15837186],\n",
       "       [-0.10900004, -0.13658918, -0.17195272,  0.05856985,  0.02719272,\n",
       "         0.24149222, -0.22078584, -0.10570825,  0.36078707, -0.07655809,\n",
       "        -0.14447072,  0.02855032, -0.09238358],\n",
       "       [-0.04362459, -0.09768072,  0.18407759,  0.05856985,  0.11402662,\n",
       "         0.38988653,  0.0259748 , -0.01998144,  0.08590168,  0.03426886,\n",
       "         0.06037582, -0.019668  ,  0.15837186],\n",
       "       [ 0.45136094,  0.05017144,  0.35162127,  0.20332787,  0.50043748,\n",
       "         0.46111581,  0.09177764,  0.06574537,  0.05154101, -0.10426483,\n",
       "         0.47006891,  0.33393304, -0.09238358],\n",
       "       [-0.18838452, -0.3233498 , -0.48609711, -0.75569398, -0.46776051,\n",
       "        -0.28679154, -0.50044791, -0.66905586, -0.8418365 , -0.29821199,\n",
       "        -0.26737865, -0.44559653, -0.21776131],\n",
       "       [-1.39316063, -1.14042752, -1.07249997, -1.73281058, -1.24926561,\n",
       "        -0.66074521, -1.27363126, -1.2936369 , -1.08236122, -1.10170738,\n",
       "        -0.67707173, -0.92777976, -0.7192722 ],\n",
       "       [-0.51993143, -0.25331457, -0.26619604, -0.75569398, -0.28106762,\n",
       "        -0.27491999, -0.18788442, -0.5343423 , -0.49822977, -0.74151979,\n",
       "        -0.02156279, -0.36523265, -0.46851675],\n",
       "       [ 0.79224721,  0.15133344,  0.41445014,  0.4566544 ,  0.64805511,\n",
       "        -0.12058991,  0.83205958,  0.88627341,  0.70439381,  0.42216318,\n",
       "         0.63394614,  0.59913382,  0.4091273 ],\n",
       "       [ 0.01708118,  0.17467852, -0.30808196, -0.52046221, -0.32882627,\n",
       "        -0.13246145, -0.12208158,  0.1392255 ,  0.12026236, -0.27050525,\n",
       "        -0.14447072,  0.20535084, -0.09238358],\n",
       "       [-0.37050184, -0.33891319, -0.24525308, -0.08618816, -0.14647508,\n",
       "        -0.28679154, -0.40174365, -0.4363688 , -0.46386909, -0.71381305,\n",
       "        -0.34931726,  0.02855032,  0.03299414],\n",
       "       [ 0.1618411 , -0.15993426, -0.287139  ,  0.11285411,  0.26164425,\n",
       "        -0.36989235, -0.03982803,  0.29843243, -0.42950842, -0.49215915,\n",
       "        -0.43125588, -0.22057768,  0.03299414],\n",
       "       [ 0.20386817,  0.18246021,  0.08983427,  0.72807567,  0.40492019,\n",
       "        -0.26898422,  0.65110177,  0.59235292, -0.1889837 , -0.10426483,\n",
       "        -0.22640934, -0.05984994,  0.03299414],\n",
       "       [-0.23041159,  0.09686159, -0.1300668 , -0.01380915,  0.14441849,\n",
       "        -0.27491999,  0.17403119, -0.01998144, -0.15462303, -0.43674568,\n",
       "        -0.26737865, -0.26879601,  0.03299414],\n",
       "       [-0.6179946 , -0.18327934,  0.00606244, -0.08618816, -0.1291083 ,\n",
       "        -0.29272731, -0.38529294, -0.04447481, -0.39514775, -0.40903894,\n",
       "        -0.14447072, -0.32505072, -0.46851675],\n",
       "       [ 1.36661722,  1.01510132,  0.92755265,  2.68230888,  1.36877648,\n",
       "        -0.64887366,  1.06236952,  1.13120715,  1.01363987,  0.83776425,\n",
       "        -0.0625321 ,  0.06069587, -0.09238358],\n",
       "       [-0.37517151, -0.08211733, -0.1824242 ,  0.32999113, -0.13344999,\n",
       "        -0.60138748, -0.18788442, -0.19143506,  0.1889837 , -0.65839958,\n",
       "        -0.63610242, -0.30897794, -0.46851675],\n",
       "       [-0.41252891, -0.05877226,  0.01653392,  0.38427539, -0.09437474,\n",
       "        -0.13246145, -0.12208158, -0.11795493,  0.15462303,  0.22821602,\n",
       "        -0.34931726, -0.34112349,  0.15837186],\n",
       "       [-1.35113356, -1.11708245, -1.04108553, -1.62424207, -1.24058222,\n",
       "        -0.6191948 , -1.29008197, -1.26914352, -1.04800054, -0.99088043,\n",
       "        -0.75901035, -0.92777976, -0.7192722 ],\n",
       "       [-0.23508126, -0.09768072, -0.37091083, -0.26713568,  0.00982594,\n",
       "        -0.03155332, -0.00692661, -0.154695  , -0.42950842, -0.18738504,\n",
       "        -0.26737865, -0.48577846, -0.59389447],\n",
       "       [ 0.24122557, -0.04320887,  0.21549203,  0.54712816,  0.43097036,\n",
       "        -0.19181918,  0.07532693,  0.4208993 , -0.15462303, -0.04885135,\n",
       "        -0.18544003, -0.41345098,  0.15837186],\n",
       "       [ 0.17585012, -0.03542718, -0.34996787,  0.31189638,  0.17046866,\n",
       "        -0.09684682,  0.27273545,  0.49437942,  0.05154101, -0.21509178,\n",
       "        -0.22640934, -0.48577846, -0.7192722 ],\n",
       "       [ 0.105805  , -0.08211733, -0.36043935,  0.14904361,  0.12705171,\n",
       "        -0.19775495, -0.3194901 ,  0.11473212, -0.42950842, -0.04885135,\n",
       "        -0.18544003, -0.50988762, -0.59389447],\n",
       "       [-0.22107224, -0.1210258 , -0.15100976,  0.16713837, -0.02924931,\n",
       "        -0.1858834 , -0.154983  , -0.26491518,  0.12026236,  0.0619756 ,\n",
       "        -0.47222519, -0.35719627, -0.34313903],\n",
       "       [ 0.1431624 , -0.11324411, -0.04629496,  0.13094886,  0.09665984,\n",
       "        -0.22743381, -0.154983  ,  0.10248543, -0.3264264 ,  0.39445645,\n",
       "        -0.26737865, -0.47774207, -0.34313903],\n",
       "       [ 0.22721655,  0.02682636, -0.15100976,  0.36618064,  0.09665984,\n",
       "        -0.19775495,  0.12467906, -0.00773475, -0.01718034, -0.07655809,\n",
       "        -0.30834795, -0.41345098, -0.21776131],\n",
       "       [-0.04362459, -0.0120821 , -0.27666752,  0.02238035, -0.02056592,\n",
       "        -0.35208504, -0.25368726,  0.09023875, -0.01718034,  0.11738907,\n",
       "        -0.18544003, -0.51792401, -0.21776131],\n",
       "       [-0.06230329,  0.15133344, -0.20336716,  0.22142262,  0.09665984,\n",
       "        -0.38769967, -0.22078584,  0.05349869, -0.25770505,  0.0619756 ,\n",
       "        -0.5131945 , -0.45363291,  0.03299414]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "scaler = StandardScaler()\n",
    "data=scaler.fit_transform(data)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0d0595a9-45cf-4976-b846-029c3d2b2aed",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 001, Training loss= 1.0016\n",
      "Epoch: 006, Training loss= 0.9951\n",
      "Epoch: 011, Training loss= 0.9883\n",
      "Epoch: 016, Training loss= 0.9816\n",
      "Epoch: 021, Training loss= 0.9740\n",
      "Epoch: 026, Training loss= 0.9656\n",
      "Epoch: 031, Training loss= 0.9552\n",
      "Epoch: 036, Training loss= 0.9433\n",
      "Epoch: 041, Training loss= 0.9294\n",
      "Epoch: 046, Training loss= 0.9137\n",
      "Epoch: 051, Training loss= 0.8964\n",
      "Epoch: 056, Training loss= 0.8772\n",
      "Epoch: 061, Training loss= 0.8555\n",
      "Epoch: 066, Training loss= 0.8314\n",
      "Epoch: 071, Training loss= 0.8058\n",
      "Epoch: 076, Training loss= 0.7794\n",
      "Epoch: 081, Training loss= 0.7490\n",
      "Epoch: 086, Training loss= 0.7089\n",
      "Epoch: 091, Training loss= 0.6653\n",
      "Epoch: 096, Training loss= 0.6215\n"
     ]
    }
   ],
   "source": [
    "autoencoder = AutoEncoder()\n",
    "autoencoder.train(data, epochs=100, batch_size=50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7c7bea59-5355-426a-8afb-cd05c0565125",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-1.33983279e-03, -1.53940485e-03],\n",
       "       [ 1.91807592e+00,  2.94192004e+00],\n",
       "       [ 1.67551029e+00,  2.92269540e+00],\n",
       "       [ 2.52426362e+00,  9.68658257e+00],\n",
       "       [-4.27630823e-03, -6.20587263e-03],\n",
       "       [-4.68950905e-03, -7.80380191e-03],\n",
       "       [-4.90878616e-03, -7.21842935e-03],\n",
       "       [-2.25619855e-03, -3.06456862e-03],\n",
       "       [-2.13039271e-03, -2.07375269e-03],\n",
       "       [-8.24436138e-04, -3.18252278e-04],\n",
       "       [-3.57971119e-04, -1.32666071e-04],\n",
       "       [-1.49335095e-03, -6.37624529e-04],\n",
       "       [ 1.44985139e-01,  1.50624856e-01],\n",
       "       [ 2.30764836e-01,  3.58338654e-01],\n",
       "       [ 3.09214056e-01,  5.00568807e-01],\n",
       "       [-2.85715167e-03, -4.37716767e-03],\n",
       "       [-5.46590379e-03, -9.23581608e-03],\n",
       "       [-2.05028406e-03, -3.56613868e-03],\n",
       "       [ 6.24674916e-01,  1.30968165e+00],\n",
       "       [-4.44393809e-04,  3.29303145e-02],\n",
       "       [-1.56554230e-03, -3.15264822e-03],\n",
       "       [-2.08116126e-05, -7.34986970e-04],\n",
       "       [ 5.91210246e-01,  5.79519689e-01],\n",
       "       [-1.13293769e-04,  1.29495710e-02],\n",
       "       [-1.51775242e-03, -3.05646961e-03],\n",
       "       [ 1.66449904e+00,  2.13447237e+00],\n",
       "       [-7.32007611e-05, -2.39791279e-03],\n",
       "       [ 2.44775474e-01,  2.21132457e-01],\n",
       "       [-5.30926930e-03, -9.07520950e-03],\n",
       "       [-1.12219260e-03, -2.27436703e-03],\n",
       "       [ 3.94975662e-01,  3.73081744e-01],\n",
       "       [ 3.40348601e-01,  1.78992286e-01],\n",
       "       [ 2.70513911e-02, -1.58830802e-03],\n",
       "       [ 1.35949716e-01,  1.70965046e-02],\n",
       "       [ 2.33193010e-01,  1.00824118e-01],\n",
       "       [ 3.10424566e-01,  1.75186664e-01],\n",
       "       [ 6.12196773e-02, -3.78286823e-05],\n",
       "       [ 6.39743507e-02, -2.25669137e-05]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 利用训练好的自编码器重构数据\n",
    "# 数据类型转换\n",
    "temp_data = torch.FloatTensor(np.array(data))\n",
    "encodedData, _ = autoencoder(temp_data)\n",
    "encodedData = encodedData.double()\n",
    "encodedData = encodedData.detach().numpy()\n",
    "encodedData"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "50484d0b-315a-44a8-ba7b-c6f9cfb23b1f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
